<template>  
    <div>
        <el-row>
            <el-col :span="24">
                <el-button type="primary" @click="openLog" size="medium">新建职位</el-button>
            </el-col>
        </el-row>
        <el-row>
            <el-col :span="24">
                <!-- 条查 -->
                <div class="grid-content bg-purple-dark">
                  <el-form :inline="true" :model="search" class="demo-form-inline" style="margin-top: 20px;">

                   <el-form-item label="负责人" :label-width="formLabelWidth">
                     <el-input v-model="search.head" placeholder="请输入内容" clearable></el-input>
                   </el-form-item>


                   <el-form-item label="部门" :label-width="formLabelWidth">
                       <el-select v-model="search.employingDepartment" placeholder="请选择" clearable>
                         <el-option
                           v-for="item in dictOne"
                           :value="item.dictLabel" 
                           :key="item.dictValue"             
                           :label="item.dictLabel">
                         </el-option>
                       </el-select>
                   </el-form-item>
                   
                   <el-form-item label="职位性质" :label-width="formLabelWidth">
                       <el-select v-model="search.postsQuality" placeholder="请选择" clearable>
                         <el-option
                           v-for="item in dictTwo"
                           :value="item.dictLabel" 
                           :key="item.dictValue"             
                           :label="item.dictLabel">
                         </el-option>
                       </el-select>
                   </el-form-item>
                  
                   <el-form-item label="学历要求" :label-width="formLabelWidth">
                       <el-select v-model="search.degree" placeholder="请选择" clearable>
                         <el-option
                           v-for="item in dictThree"
                           :value="item.dictLabel" 
                           :key="item.dictValue"             
                           :label="item.dictLabel">
                         </el-option>
                       </el-select>
                   </el-form-item>

                   <el-form-item label="发起时间" :label-width="formLabelWidth">
                   <div class="block">
                    <el-date-picker
                        v-model="checkDate"
                        type="daterange"
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                             unlink-panels
                       value-format="yyyy-MM-dd"
                        >
                        </el-date-picker>
                   </div>
                   </el-form-item>


                      <el-button type="primary" @click="searchTem" size="medium" style="margin-left: 710px; width: 100px;">搜索</el-button>
                      &nbsp;
                      <!-- 导出 -->
                      <el-button   size="medium"  plain @click="exportExcel()" style="width: 80px;">
                            <i class="el-icon-upload2">导出</i>
                        </el-button>
                  </el-form>
                  </div>
            </el-col>
        </el-row>


        <el-row>
            <!-- 展示 -->
              <el-col :span="24"><div class="grid-content bg-purple-dark">
                  <el-table :data="Position"  height="550" >
                    <el-table-column label="职位信息">
                        <template slot-scope="scope">
                              <span style="font-weight:800">{{scope.row.jobTitle }}</span> &nbsp;&nbsp;&nbsp;
                              <span style="font-weight:100;font-size: 12px;">职位ID {{scope.row.jobId }}</span>
                              <br>
                              <br>
                              <span>接受简历 8</span> &nbsp;&nbsp;&nbsp;&nbsp;
                              <span>初筛 6</span> &nbsp;&nbsp;&nbsp;&nbsp;
                              <span>待面试 6</span> &nbsp;&nbsp;&nbsp;&nbsp;
                              <span>通过面试 6</span> &nbsp;&nbsp;&nbsp;&nbsp;
                              <span>已发offer 6</span> &nbsp;&nbsp; &nbsp;&nbsp;
                              <span>人才库 6</span>

                        </template>
                    </el-table-column>


                    <el-table-column label="操作" width="260">
                        <template slot-scope="scope">
                            <el-button size="medium " v-if="scope.row.state == 0" type="text" @click="updateStatus(scope.row)"  >招聘中</el-button>
                            <el-button size="medium " v-else type="text" @click="updateState(scope.row)"  >停止招聘</el-button>
                            <el-button size="medium " type="text" @click="getAdmin(scope.row)" >编辑</el-button>
                            <el-button size="medium " type="text" @click="delAdmin(scope.row)"  >删除</el-button>



                        </template>
                    </el-table-column>
                  </el-table>

                <!-- 分页 -->
                <div class="block">
                    <el-pagination
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page="pageNum"
                    :page-sizes="[2, 4, 6, 8]"
                    :page-size="pageSize"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="total" style="float:right">
                    </el-pagination>
                </div>
                  </div>
            </el-col>
        </el-row>


        <el-dialog title="停招原因" :visible.sync="dialogFormVisible">
            <el-form :model="form">
                <el-form-item label="停招原因" :label-width="formLabelWidth">
                <el-input v-model="form.cause" autocomplete="off"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="dialogFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="ok">确 定</el-button>
            </div>
        </el-dialog>



        <el-dialog :title="title" :visible.sync="dialogForm" width="70%">
            <el-form :model="addPosition">
                <el-steps :active="active" finish-status="success">
                    <el-step title="职位信息"></el-step>
                    <el-step title="职位设置"></el-step>
                </el-steps>
                <div v-if="active===1">
                    <el-row>
                        <el-col :span="24">
                            <div style="font-size: 20px;">
                                职位信息
                            </div>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="职位名称" :label-width="formLabelWidth">
                                <el-input v-model="addPosition.jobTitle" autocomplete="off"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="招聘人数" :label-width="formLabelWidth">
                                <el-input v-model="addPosition.recruitNumber" autocomplete="off"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            
                            <el-form-item label="职业性质" :label-width="formLabelWidth">
                                <el-select v-model="addPosition.postsQuality" placeholder="请选择" style="width: 300px;" clearable>
                                    <el-option
                                    v-for="item in dictTwo"
                                    :value="item.dictLabel" 
                                    :key="item.dictValue"             
                                    :label="item.dictLabel">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                             <el-form-item label="用人部门" :label-width="formLabelWidth">
                                <el-select v-model="addPosition.employingDepartment" placeholder="请选择" style="width: 300px;" clearable>
                                    <el-option
                                    v-for="item in dictOne"
                                    :value="item.dictLabel" 
                                    :key="item.dictValue"             
                                    :label="item.dictLabel">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="工作地点" :label-width="formLabelWidth">
                                <el-input v-model="addPosition.jobPlace" autocomplete="off"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="详细地址" :label-width="formLabelWidth">
                                <el-input v-model="addPosition.detailedAddress" autocomplete="off"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>


                    <el-row>
                        <el-col :span="24">
                            <div style="font-size: 20px;">
                                招聘要求
                            </div>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="薪资范围" :label-width="formLabelWidth">
                                <el-input v-model="addPosition.bottomRange" autocomplete="off" style="width: 70px"></el-input>
                                -
                                <el-input v-model="addPosition.highestSalary" autocomplete="off" style="width: 70px"></el-input>
                                &nbsp;
                                <el-input v-model="addPosition.salary" autocomplete="off" style="width: 70px"></el-input>薪
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="学历要求" :label-width="formLabelWidth">
                                <el-select v-model="addPosition.degree" placeholder="请选择" style="width: 300px;" clearable>
                                    <el-option
                                    v-for="item in dictThree"
                                    :value="item.dictLabel" 
                                    :key="item.dictValue"             
                                    :label="item.dictLabel">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="工作经历" :label-width="formLabelWidth">
                                <el-select v-model="addPosition.workExperience" placeholder="请选择" style="width: 300px;" clearable>
                                    <el-option
                                    v-for="item in dictFour"
                                    :value="item.dictLabel" 
                                    :key="item.dictValue"             
                                    :label="item.dictLabel">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="专业" :label-width="formLabelWidth">
                                <el-input v-model="addPosition.specialized" autocomplete="off"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="24">
                            <el-form-item label="职位描述">
                                <MyEditor
                                    id="editor"
                                    ref="editor"
                                    :wordNum="TiLength"
                                    v-model="addPosition.description"
                                    @change="onEditorChange($event)"
                                >
                                </MyEditor>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="24">
                            <el-form-item label="文件上传">
                            <el-upload
                                class="upload-demo"
                                action="/api/upload"  
                                :headers="uploadHeaders"
                                :on-change="handleChange"
                                :on-remove="handleRemove"
                                :before-upload="beforeUpload"
                                :on-success="handleSuccess"
                                :on-error="handleError"
                                :limit="5" 
                                :on-exceed="handleExceed"
                                :file-list="fileList"
                          
                                >
                                <el-button>点击上传</el-button>
                                <div slot="tip" class="el-upload__tip">
                                    支持扩展名：rar, zip, doc, docx, pdf, jpg，单个文件不超过10MB
                                </div>
                            </el-upload>
                        </el-form-item>
                        </el-col>
                    </el-row>
                </div>
                <div v-if="active===2">
                    <el-row>
                        <el-col :span="24">
                            <div style="font-size: 20px;">
                                招聘信息
                            </div>
                        </el-col>
                    </el-row>

                    <el-row>
                        <el-col :span="24">
                            <el-form-item label="计划启动日期" :label-width="formLabelWidth">
                                <el-date-picker
                                v-model="addPosition.initiationDate"
                                type="date"
                                placeholder="选择日期"
                                value-format="yyyy-MM-dd HH:mm:ss"

                                >
                                </el-date-picker>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="24">
                            <el-form-item label="最晚到岗日期" :label-width="formLabelWidth">
                                <el-date-picker
                                v-model="addPosition.arrivalData"
                                type="date"
                                placeholder="选择日期"
                                value-format="yyyy-MM-dd HH:mm:ss"
                                >
                                </el-date-picker>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="24">
                            <el-form-item label="招聘负责人" :label-width="formLabelWidth">
                                
                                <el-button class="custom-button" @click="openTree(1)"><span class="icon">+</span></el-button>
                                {{zhaopinfuzeren}}
                            </el-form-item>

                        </el-col>
                    </el-row>
               
                            <el-form-item label="用人经理" :label-width="formLabelWidth">
                                <el-button class="custom-button" @click="openTree(2)"><span class="icon">+</span></el-button>
                                {{yongrenjingli}}
                            </el-form-item>
                            
                 
              
                            <el-form-item label="简历初筛人员" :label-width="formLabelWidth">
                                <el-button class="custom-button" @click="openTree(3)"><span class="icon">+</span></el-button>
                                {{renyuan}}
                            </el-form-item>
                            <el-row>
                                <el-col :span="24">
                                    <div style="font-size: 20px;">
                                        面试轮次
                                    </div>
                                </el-col>
                            </el-row>
                            <el-row v-for="(item,index) in temViewers" :key="index">
                                            <el-col :span="8">
                                <el-form-item :label="'第'+ (index+1) +'轮面试官'">


                                <el-dialog width="30%" :visible.sync="dialogVis">
                                    <el-form :model="addPosition">
                                    <el-form-item label="部门" :label-width="formLabelWidth">
                                        <!--菜单树  -->
                                        <el-tree
                                        :data="positionTreeData"
                                        node-key="id"
                                        ref="deptTree"
                                        highlight-current
                                        :props="defaultProps"
                                        @node-click="handleNodeClick(index, $event)">
                                        </el-tree>
                                    </el-form-item>
                                    </el-form>
                                    <div slot="footer" class="dialog-footer">
                                    <el-button @click="dialogVis = false">取 消</el-button>
                                    <el-button type="primary" @click="getChecked()">确 定</el-button>
                                    </div>
                                </el-dialog>
                                <el-button class="custom-button" @click="Pop(index + 1)"><span class="icon">+</span></el-button>
                                <span style="font-weight:800; font-size: 16px;">{{ item.interviewer }}</span>
                                </el-form-item>
                            </el-col>
                                <el-col :span="8">
                                    <el-form-item label="会议室">
                                        <el-input v-model="item.conferenceRoom"  autocomplete="off" style="width: 240px"></el-input>
                                        &nbsp;
                                        <el-button type="text" @click="add">添加</el-button>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <div style="font-size: 20px;">
                                        用人标准
                                    </div>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="性别" :label-width="formLabelWidth">
                                        <el-select v-model="addPosition.sex" placeholder="请选择" clearable>
                                            <el-option
                                            v-for="item in dictFive"
                                            :value="item.dictLabel" 
                                            :key="item.dictValue"             
                                            :label="item.dictLabel">
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="学历" :label-width="formLabelWidth">
                                        <el-select v-model="addPosition.degree" placeholder="请选择" clearable>
                                            <el-option
                                            v-for="item in dictThree"
                                            :value="item.dictLabel" 
                                            :key="item.dictValue"             
                                            :label="item.dictLabel">
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="工作经验" :label-width="formLabelWidth">
                                        <el-select v-model="addPosition.workExperience" placeholder="请选择" clearable>
                                            <el-option
                                            v-for="item in dictFour"
                                            :value="item.dictLabel" 
                                            :key="item.dictValue"             
                                            :label="item.dictLabel">
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="年龄" :label-width="formLabelWidth">
                                        <el-select v-model="addPosition.age" placeholder="请选择" clearable>
                                            <el-option
                                            v-for="item in dictSix"
                                            :value="item.dictLabel" 
                                            :key="item.dictValue"             
                                            :label="item.dictLabel">
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        
                            
                        
                </div>
                  
               
            </el-form>
            <div slot="footer" class="dialog-footer"> 
                <el-button   v-if="active ===1" @click="dialogFormVisible = false">取 消</el-button>
                <el-button size="medium"  v-if="active ===1" type="primary" style="margin-top: 12px; margin-right: 40px;" @click="next">下一步</el-button>

                <el-button size="medium"  v-if="active ===2"  style="margin-top: 12px;" @click="opxt">上一步</el-button>

                <el-button size="medium"  v-if="active ===2 && title == '新增'" type="primary" style=" margin-right: 40px;" @click="addJob">完成</el-button>
                  <el-button size="medium"  v-if="active ===2 && title == '修改'" type="primary" style=" margin-right: 40px;" @click="upJob">修改</el-button>
            </div> 
        </el-dialog>
        <el-dialog title="" :visible.sync="dialogOne">
            <el-form :model="addPosition">
                <el-form-item label="部门" :label-width="formLabelWidth">
                    <el-tree
                    :data="positionTreeData"
                    node-key="id"
                    ref="tree"
                    highlight-current
                    :props="defaultProps"
                    >
                </el-tree>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="dialogOne = false">取 消</el-button>
                <el-button type="primary" @click="getCheckedNodes()">确 定</el-button>
            </div>
        </el-dialog>
    </div>
</template>
<script>
import axios from 'axios'
import { getToken } from '@/util/auth'
import MyEditor from "@/components/MyEditor/editor.vue";
export default {
    components: {
        MyEditor,
    },

    data(){
        return {
            Position:[],
            checkDate:[],
            uploadHeaders:{"Authorization": getToken()}, //获取登录值
            form:{
                id:'',
                cause:''
            },
            labelName:'',
            zhaopinfuzeren: '',
            yongrenjingli:'',
            renyuan:'',
            temViewers:[{
                interviewer: '', 
                conferenceRoom: ''
            }],
            positionTreeData:[],
            
            addPosition:{
                temViewers:[],
                "age": null,
                "arrivalData": "",
                "bottomRange": null,
                "cause": "",
                "degree": "",
                "description": "",
                "detailedAddress": "",
                "employingDepartment": "",
                "endDate": "",
                "fileUpload": "",
                "head": "",
                "highestSalary": null,
                "id": 0,
                "initiationDate": "",
                "jobId": null,
                "jobManger": "",
                "jobPlace": "",
                "jobTitle": "",
                "postsQuality": "",
                "primaryScreening": "",
                "recruitNumber": null,
                "salary": null,
                "sex": "",
                "specialized": "",
                "startDate": "",
                "state": null,
                "workExperience": ""
            },
            active:1,
            dictOne:[],
            dictTwo:[],
            dictThree:[],
            dictFour:[],
            dictFive:[],
            dictSix:[],
            pageNum:1,
            pageSize:2,
            total:null,
            dialogFormVisible:false,
            dialogForm:false,
            dialogOne:false,
            dialogVis:false,
            title:'新增',
            search:{
                head:'',
                employingDepartment:'',
                postsQuality:"",
                degree:"",
                startDate:"",
                endDate:""
            },
            formLabelWidth:"120px",
            defaultProps: {
              children: 'children',
              label: 'label'
            },

        }
        
    },
    created(){
        this.findTemList(),
        this.findDict()
    },
    methods:{

        //回显
        getAdmin(row){
            this.title = "修改"
            this.dialogForm = true
            axios.get("/api/tem/getTem?id="+row.id).then(res=>{
                this.addPosition = res.data.data
                this.temViewers = res.data.data.temViewers
                this.zhaopinfuzeren = res.data.data.head
                this.yongrenjingli = res.data.data.jobManger
                this.renyuan = res.data.data.primary_screening
                console.log("回显",this.addPosition);
                
            
            })
        },
        handleNodeClick(index, data) {
          if (data && data.label) {
            this.temViewers[index].interviewer = data.label;
            console.log('index', this.temViewers[index].interviewer);
          } else {
            console.error('Invalid node data:', data);
          }
        },


        getChecked() {
          this.dialogVis = false;
        },

        Pop() {
          this.dialogVis = true;
          this.findDictTree();
        },
        //修改
        upJob(){
            this.addPosition.temViewers = this.temViewers
             this.addPosition.head = this.zhaopinfuzeren
            this.addPosition.jobManger = this.yongrenjingli
            this.addPosition.primaryScreening = this.renyuan
            axios.post("/api//tem/updateTem",this.addPosition).then(res=>{
                if (res.data.code == 200) {
                    this.dialogForm = false
                }
                this.findTemList()
            })
        },

        //新增
        addJob(){
            this.addPosition.head = this.zhaopinfuzeren
            this.addPosition.jobManger = this.yongrenjingli
            this.addPosition.primaryScreening = this.renyuan
            this.addPosition.temViewers =  this.temViewers
            console.log("新增add" ,this.addPosition);
            axios.post("/api/tem/addTem",this.addPosition).then(res=>{
                this.findTemList()
            })
        },



        //点击添加面试轮次
        add(){
            this.temViewers.push({
                interviewer: '', 
                conferenceRoom: ''
            })
        },
          //删除
        delAdmin(row){
            axios.delete("/api/tem/delTemById?id="+row.id).then(res=>{
                this.findTemList()
            })
        },

        //打开部门树弹框
        openTree(job){
            this.dialogOne = true
            this.findDictTree()
            this.labelName = job
        },

        getCurrentLabel() {
          const currentNode = this.$refs.tree.getCurrentNode();
          return currentNode ? currentNode.label : null;
        },
        //点击确认  
        getCheckedNodes(){
            console.log("aaa",this.$refs.tree.getCheckedNodes());
          let currentLabel = this.getCurrentLabel();
          console.log('aaa',currentLabel);
          if (this.labelName == 1) {
            this.zhaopinfuzeren = currentLabel;
            console.log('第一',this.zhaopinfuzeren);
          } else if (this.labelName == 2) {
            this.yongrenjingli = currentLabel
            console.log('第2',this.yongrenjingli);
          } else if (this.labelName == 3) {
            this.renyuan = currentLabel
            console.log('第3', this.renyuan);
          }  
        },
        //查询部门树
        findDictTree(){
            axios.post("/api/tree/findDepartmentTree",{}).then(res=>{
                this.positionTreeData = res.data.data
            })
        },
        //查询
        findTemList(){
            axios.post("/api/tem/findTemList?pageNum="+this.pageNum + '&pageSize=' + this.pageSize,this.search).then(res=>{
                this.Position = res.data.data.items
                this.total = res.data.data.totalElements
            })

        },
        //打开新增弹框
        openLog(){
            this.title = "新增"
            this.active = 1
            this.addPosition = {}
            this.temViewers =[{}]
            this.renyuan = ''
            this.zhaopinfuzeren = ''
            this. yongrenjingli = ''
            this.addPosition.description = ''
         this.dialogForm=true
        },
        //富文本
        onEditorChange(e) {
             this.addPosition.description=e.replace(/<p>\s*<\/p>/g, '').replace(/^<p>(.*)<\/p>$/, '$1')      
            console.log( this.addPosition.description, "aaa");
            var reg = /<[^<>]+>/g; //去标签
            // var reg = /<(?!img).*?>/g //去除img以外的所有标签
            var value = e.replace(reg, "");
            value = value.replace(/&nbsp;/gi, ""); //将空格全部替换
            this.TiLength = value.length; //文字长度显示
            console.log(this.TiLength, "  this.TiLength");
            if (this.TiLength <= 20) {
              this.editorHtml = e;
              console.log(this.editorHtml, "this.editorHtml");
            }
            if (this.TiLength > 20) {
              //当长度大于10时,只截取10之前的内容并赋值
              this.$nextTick(() => {
                this.form.content = this.editorHtml;
              });
              this.warnShow = true;
              // this.$message.error("文字最多输入10字!");
              return false;
            }
          },
          //下一步步骤条
        next() {
            if (this.active++ > 2) this.active = 1;
          },
          //上一步步骤条
        opxt(){
            if (this.active-- < 1) this.active = 1;
        },
        //条查
        searchTem(){
            this.search.startDate=this.checkDate[0];
            this.search.endDate=this.checkDate[1];
            this.findTemList();
        },

        //停招原因弹框
        updateState(row){
            this.dialogFormVisible = true;
            this.form.id = row.id
        },
        //修改原因和状态
        ok(){
            axios.post("/api/tem/updateState",this.form).then(res=>(
                this.findTemList()
            ))
        },
        //查询字典表信息
        findDict(){
               // 部门 tem_department_type
            axios.post("/api/dict/findDictByType?dictType=tem_department_type").then(res=>{
                this.dictOne = res.data.data
            }),
               // 职业性质 tem_nature_type
            axios.post("/api/dict/findDictByType?dictType=tem_nature_type").then(res=>{
                this.dictTwo = res.data.data
            }),
             // 学历 tem_educational_type
             axios.post("/api/dict/findDictByType?dictType=tem_educational_type").then(res=>{
                this.dictThree = res.data.data
            }),
            // 经验 tem_work_experience
            axios.post("/api/dict/findDictByType?dictType=tem_work_experience").then(res=>{
                this.dictFour = res.data.data
            }),
            //性别 tem_user_sex
            axios.post("/api/dict/findDictByType?dictType=tem_user_sex").then(res=>{
                this.dictFive = res.data.data
            })
            //年龄 tem_user_age
            axios.post("/api/dict/findDictByType?dictType=tem_user_age").then(res=>{
                this.dictSix = res.data.data
            })
        },
        //分页
        handleSizeChange(val) {
          this.pageSize = val;
          console.log(`每页 ${val} 条`);
          this.initList();
        },
        handleCurrentChange(val) {
          this.pageNum = val;
          console.log(`当前页: ${val}`);
           this.initList()
        },
            //修改状态
        updateStatus(row){
            axios.post("/api/tem/updateStatus?id="+row.id).then(res=>{
                this.findTemList()
            })
        },
        // 文件状态改变时的钩子
        handleChange(file, fileList) {
        this.fileList = fileList;
        },




        // 文件移除时的钩子
        handleRemove(file, fileList) {
        this.fileList = fileList;
        },




        // 上传前的校验
        beforeUpload(file) {
        const allowedTypes = [
            "application/x-rar-compressed",
            "application/zip",
            "application/msword",
            "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
            "application/pdf",
            "image/jpeg",
        ];




        const isAllowedType = allowedTypes.includes(file.type);
        const isLt10MB = file.size / 1024 / 1024 < 10;




        if (!isAllowedType) {
            this.$message.error("只支持上传 rar, zip, doc, docx, pdf, jpg 格式的文件！");
        }
        if (!isLt10MB) {
            this.$message.error("单个文件大小不能超过 10MB！");
        }




        return isAllowedType && isLt10MB;
        },




        // 上传成功时的钩子
        handleSuccess(response, file, fileList) {
        this.$message.success("文件上传成功！");
        console.log("上传成功", response, file, fileList);
        this.addPosition.fileUpload = response.data;
        },




        // 上传失败时的钩子
        handleError(err, file, fileList) {
        this.$message.error("文件上传失败，请重试！");
        console.error("上传失败", err, file, fileList);
        },




        // 超出文件数量限制时的钩子
        handleExceed(files, fileList) {
        this.$message.warning(`最多只能上传 ${this.limit} 个文件`);
        },
        
    }

    




}
</script>
<style>

</style>
